import Mock from 'mockjs'
import { getAllCompony, getFieldTypes } from './commonApi'
import {
  getFieldList, getFieldDetail, getAllFields, getTypeFields, checkNameExists, addField, updateField, changeStatus, deleteField
} from './fieldApi'
import {
  getMessageList, addTemplate, updateTemplate, templeteExists, changeTemplateStatus,
  getSmsTemplate
} from './messageApi'
import {
  getCaptcha,
  login,
  getPermissons,
  logout,
  getUserList,
  addUser,
  checkNameExist,
  updateUser,
  updateUserStatus,
  deleteUser,
  getDepartmentList,
  addDepartment,
  updateDepartment,
  deleteDepartment,
  getRolelist,
  checkRoleExist,
  addRole,
  updateRole,
  deleteRole,
  getRoleRolelist,
  getAll,
  getResource,
  addResource,
  updateResource,
  deleteResource
} from './authApi'

// 字段模板管理
Mock.mock(/\/variable\/template\/list/, 'post', getFieldList)
Mock.mock(/\/variable\/template\/getVariableById/, 'post', getFieldDetail)
Mock.mock(/\/variable\/template\/systemVariable/, 'post', getAllFields)
Mock.mock(/\/variable\/template\/getVariableByType/, 'post', getTypeFields)
Mock.mock(/\/variable\/template\/getVariableByName/, 'post', checkNameExists)
Mock.mock(/\/variable\/template\/save/, 'post', addField)
Mock.mock(/\/variable\/template\/update/, 'post', updateField)
Mock.mock(/\/variable\/template\/forbidden/, 'post', changeStatus)
Mock.mock(/\/variable\/template\/delete/, 'post', deleteField)

// 短信任务模板
Mock.mock(/\/sms\/task\/template\/list/, 'post', getMessageList)
Mock.mock(/\/sms\/task\/template\/add/, 'post', addTemplate)
Mock.mock(/\/sms\/task\/template\/update/, 'post', updateTemplate)
Mock.mock(/\/sms\/task\/template\/name\/exist/, 'post', templeteExists)
Mock.mock(/\/sms\/task\/template\/status/, 'post', changeTemplateStatus)
Mock.mock(/\/sms\/task\/template\/smsTemplate/, 'post', getSmsTemplate)

// common
Mock.mock(/\/common\/companyList/, 'get', getAllCompony)
Mock.mock(/\/common\/get\/op\/enum/, 'post', getFieldTypes)

// auth
Mock.mock(/\/captcha.do/, 'get', getCaptcha)
Mock.mock(/\/mapper\/auth\/login.do/, 'post', login)
Mock.mock(/\/mapper\/auth\/loginOut.do/, 'get', logout)
Mock.mock(/\/mapper\/auth.do/, 'get', getPermissons)

Mock.mock(/\/user\/list/, 'post', getUserList)
Mock.mock(/\/user\/name\/exist/, 'post', checkNameExist)
Mock.mock(/\/user\/add/, 'post', addUser)
Mock.mock(/\/user\/update/, 'post', updateUser)
Mock.mock(/\/user\/forbidden/, 'post', updateUserStatus)
Mock.mock(/\/user\/delete/, 'post', deleteUser)

Mock.mock(/\/department\/list/, 'post', getDepartmentList)
Mock.mock(/\/department\/add/, 'post', addDepartment)
Mock.mock(/\/department\/update/, 'post', updateDepartment)
Mock.mock(/\/department\/delete/, 'post', deleteDepartment)

Mock.mock(/\/role\/rolelist/, 'post', getRoleRolelist)
Mock.mock(/\/role\/list/, 'post', getRolelist)
Mock.mock(/\/role\/add/, 'post', addRole)
Mock.mock(/\/role\/name\/exist/, 'post', checkRoleExist)
Mock.mock(/\/role\/update/, 'post', updateRole)
Mock.mock(/\/role\/delete/, 'post', deleteRole)
Mock.mock(/\/resourceTree\/getAll/, 'post', getAll)
Mock.mock(/\/roleType\/resource/, 'post', getResource)
Mock.mock(/\/resourceTree\/save/, 'post', addResource)
Mock.mock(/\/resourceTree\/update/, 'post', updateResource)
Mock.mock(/\/resourceTree\/delete/, 'post', deleteResource)

export default Mock
